﻿//-----------------------------------------------------------------------------------------
// <copyright file="FlakerService.Story.cs" company="Jakub Florczyk (www.jakubflorczyk.pl)">
//      Copyright © 2009 Jakub Florczyk (www.jakubflorczyk.pl)
//      http://flakernet.codeplex.com
// </copyright>
//-----------------------------------------------------------------------------------------

namespace FlakerNET
{
    using System;
    using System.Globalization;
    using FlakerNET.Containers;

    /// <summary>
    /// Flaker serwis.
    /// </summary>
    public partial class FlakerService
    {
        /// <summary>
        /// Zwraca wpisy danej historyjki.
        /// </summary>
        /// <param name="storyId">Identyfikator historyjki.</param>
        /// <returns>Wpisy historyjki.</returns>
        public Entry[] GetStory(int storyId)
        {
            return RequestGet<EntriesContainer>(String.Format(CultureInfo.InvariantCulture, "/type:story/story:{0}", storyId)).Entries;
        }

        /// <summary>
        /// Zwraca wpisy danej historyjki.
        /// </summary>
        /// <param name="storyId">Identyfikator historyjki.</param>
        /// <param name="source">Żródło wpisów.</param>
        /// <returns>Wpisy historyjki.</returns>
        public Entry[] GetStory(int storyId, string source)
        {
            return RequestGet<EntriesContainer>(String.Format(CultureInfo.InvariantCulture, "/type:story/story:{0}/source:{1}", storyId, source)).Entries;
        }

        /// <summary>
        /// Zwraca wpisy danej historyjki.
        /// </summary>
        /// <param name="storyId">Identyfikator historyjki.</param>
        /// <param name="source">Żródło wpisów.</param>
        /// <param name="tag">Filtruje wpisy według danego tagu.</param>
        /// <returns>Wpisy historyjki.</returns>
        public Entry[] GetStory(int storyId, string source, string tag)
        {
            return RequestGet<EntriesContainer>(String.Format(CultureInfo.InvariantCulture, "/type:story/story:{0}/source:{1}/tag:{2}", storyId, source, tag)).Entries;
        }

        /// <summary>
        /// Zwraca wpisy danej historyjki.
        /// </summary>
        /// <param name="storyId">Identyfikator historyjki.</param>
        /// <param name="source">Żródło wpisów.</param>
        /// <param name="tag">Filtruje wpisy według danego tagu.</param>
        /// <param name="avatarsSize">Rozmiar zwracanych avatarów.</param>
        /// <returns>Wpisy historyjki.</returns>
        public Entry[] GetStory(int storyId, string source, string tag, AvatarsSize avatarsSize)
        {
            return RequestGet<EntriesContainer>(String.Format(CultureInfo.InvariantCulture, "/type:story/story:{0}/source:{1}/tag:{2}/avatars:{3}", storyId, source, tag, avatarsSize.ToString().ToLower(CultureInfo.InvariantCulture))).Entries;
        }

        /// <summary>
        /// Zwraca wpisy danej historyjki.
        /// </summary>
        /// <param name="storyId">Identyfikator historyjki.</param>
        /// <param name="source">Żródło wpisów.</param>
        /// <param name="tag">Filtruje wpisy według danego tagu.</param>
        /// <param name="avatarsSize">Rozmiar zwracanych avatarów.</param>
        /// <param name="comments">Czy wpis ma zawierać komentarze.</param>
        /// <returns>Wpisy historyjki.</returns>
        public Entry[] GetStory(int storyId, string source, string tag, AvatarsSize avatarsSize, bool comments)
        {
            return RequestGet<EntriesContainer>(String.Format(CultureInfo.InvariantCulture, "/type:story/story:{0}/source:{1}/tag:{2}/avatars:{3}/comments:{4}", storyId, source, tag, avatarsSize.ToString().ToLower(CultureInfo.InvariantCulture), comments.ToString(CultureInfo.InvariantCulture).ToLower(CultureInfo.InvariantCulture))).Entries;
        }

        /// <summary>
        /// Zwraca wpisy danej historyjki.
        /// </summary>
        /// <param name="storyId">Identyfikator historyjki.</param>
        /// <param name="source">Żródło wpisów.</param>
        /// <param name="tag">Filtruje wpisy według danego tagu.</param>
        /// <param name="avatarsSize">Rozmiar zwracanych avatarów.</param>
        /// <param name="comments">Czy wpis ma zawierać komentarze.</param>
        /// <param name="limit">Limit ilości.</param>
        /// <returns>Wpisy historyjki.</returns>
        public Entry[] GetStory(int storyId, string source, string tag, AvatarsSize avatarsSize, bool comments, int limit)
        {
            return RequestGet<EntriesContainer>(String.Format(CultureInfo.InvariantCulture, "/type:story/story:{0}/source:{1}/tag:{2}/avatars:{3}/comments:{4}/limit:{5}", storyId, source, tag, avatarsSize.ToString().ToLower(CultureInfo.InvariantCulture), comments.ToString(CultureInfo.InvariantCulture).ToLower(CultureInfo.InvariantCulture), limit)).Entries;
        }

        /// <summary>
        /// Zwraca wpisy danej historyjki.
        /// </summary>
        /// <param name="storyId">Identyfikator historyjki.</param>
        /// <param name="source">Żródło wpisów.</param>
        /// <param name="tag">Filtruje wpisy według danego tagu.</param>
        /// <param name="avatarsSize">Rozmiar zwracanych avatarów.</param>
        /// <param name="comments">Czy wpis ma zawierać komentarze.</param>
        /// <param name="limit">Limit ilości.</param>
        /// <param name="start">Identyfikator wpisu od którego chcemy rozpocząć pobieranie.</param>
        /// <returns>Wpisy historyjki.</returns>
        public Entry[] GetStory(int storyId, string source, string tag, AvatarsSize avatarsSize, bool comments, int limit, int start)
        {
            return RequestGet<EntriesContainer>(String.Format(CultureInfo.InvariantCulture, "/type:story/story:{0}/source:{1}/tag:{2}/avatars:{3}/comments:{4}/limit:{5}/start:{6}", storyId, source, tag, avatarsSize.ToString().ToLower(CultureInfo.InvariantCulture), comments.ToString(CultureInfo.InvariantCulture).ToLower(CultureInfo.InvariantCulture), limit, start)).Entries;
        }
    }
}
